Ravi Vishwakarma is a dedicated Software Developer with a passion for crafting efficient and innovative solutions. With a keen eye for detail and years of experience, he excels in developing robust software systems that meet client needs. His expertise spans across multiple programming languages and technologies, making him a valuable asset in any software development project.
ICSM Computer
15-Sep-2025There are two main types:
1. Implicit Casting (Type Conversion)
Done automatically by Python (no data loss).
For example, when combining an integer with a float:
2. Explicit Casting (Type Conversion)
Done manually by the programmer using functions:
int()→ converts to integerfloat()→ converts to floating-point numberstr()→ converts to stringbool()→ converts to booleanExamples:
Summary Table of Casting Functions in Python:
int(x)int("12") → 12float(x)float("3.5") → 3.5str(x)str(99) → "99"bool(x)bool(0) → False